"""
@Author:WKVugen
@Time:2023-06-28
@Description: 工具类
"""
import time
import unittest

from selenium import webdriver

from utils.config import Config


# class BaseUtil(unittest.TestCase):
class BaseUtil:
    test_info = Config().get('test_info')
    url = test_info['url']
    # def setUp(self) -> None:
    def setup_class(self):
        global driver
        options = webdriver.ChromeOptions()
        options.add_experimental_option("detach", True)  # 设置执行完后不关闭浏览器
        self.driver = webdriver.Chrome(options=options)
        driver = self.driver
        # 打开招商后台系统
        self.driver.get(self.url)
        self.driver.maximize_window()

    def setUp(self) -> None:
        # global driver
        # options = webdriver.ChromeOptions()
        # options.add_experimental_option("detach", True)  # 设置执行完后不关闭浏览器
        # self.driver = webdriver.Chrome(options=options)
        # driver = self.driver
        # # 打开招商后台系统
        # self.driver.get(self.url)
        # self.driver.maximize_window()
        pass


    def teardown(self) -> None:
        time.sleep(3)
        self.driver.quit()